<?php $this->headScript()->captureStart() ?>
$(document).ready(function(){
    var options = { 
        type:"POST",
        dataType : "text",
        buttons:$('#registerForm').find("button[name='button']"),
        async : true,
        cache: false,
        success:function(responseText, statusText)
        {
            var json = jQuery.parseJSON(responseText);
            if(json.result != 1){
                dialogMessage(json.messages);
                $('#registerForm').find(".captcha").reloadCaptcha();
                return false;
            }
            
            dialogTipRedirect(json.messages, '<?php echo $this->referer;?>');
            return true;
        },
    };
    var v = jQuery("#registerForm").validate({
        debug: true,
        messages: {
            username: {
                required: "<?php echo $this->translate("Please enter a username.");?>",
            },
            email: {
                required: "<?php echo $this->translate("Please enter a email.");?>",
                email: "<?php echo $this->translate("Please enter a valid email.");?>",
            },
            password: {
                required: "<?php echo $this->translate("Please provide a password.");?>",
                minlength: "<?php echo $this->translate("Your password must be at least 6 characters long.");?>",
            },
            confirmPassword: {
                required: "<?php echo $this->translate("Please provide a confirm password.");?>",
                minlength: "<?php echo $this->translate("Your confirm password must be at least 6 characters long.");?>",
                equalTo: "<?php echo $this->translate("Please enter the same password as above.");?>",
            },
            nickname: {
                required: "<?php echo $this->translate("Please enter a nickname.");?>",
            },
        },
        rules: {
            username: {
                required: true,
            },
            email: {
                required: true,
                email: true,
            },
            password: {
                required: true,
                minlength: 6,
            },
            confirmPassword: {
                required: true,
                minlength: 6,
                equalTo: "#password",
            },
            nickname: {
                required: true,
            },
        },
        errorPlacement: function(error, element) {
            var elementName = element.attr("name");
            var idTip = 'tip-' + elementName;
            $("#" + idTip).html(error);
        },
        success: function(label) {
            label.addClass("valid").text("Ok!");
        },
        submitHandler: function(form) {
            jQuery(form).ajaxSubmit(options);
        }
    });
});
<?php $this->headScript()->captureEnd() ?>

<div class="container">
    <div class="column span-11 colborder">
        <h3>
            <?php echo $this->translate("Not have a account? Please register.");?>
        </h3>
        <div class="prepend-top">
        <?php echo $this->formRegister;?>
        </div>
    </div>
    <div class="column span-11 last">
        <h3>
            <?php echo $this->translate("Already have a account? Please login.");?>
        </h3>
        <div class="prepend-top">
            <a href="<?php echo $this->urls->login; ?>"><?php echo $this->translate('Click here to login.');?></a>
        </div>
        
        <div class="prepend-top">&nbsp;</div>
        <h3>
            <?php echo $this->translate("User othor's account to login.");?>
        </h3>
        <div class="prepend-top">
            <?php foreach($this->adapters as $key=>$adapter):?>
            <a href="<?php echo $this->url(array('module'=>'account', 'controller'=>'auth', 'action'=>'show-oauth-form', 'adapter'=>$adapter),'default',true) ?>"><img src="<?php echo $this->baseUrl('ui/style/base/default/images/oauth/'.$adapter.'.png');?>" alt="<?php echo $adapter;?>" title="<?php echo $adapter;?>"></a>
            <?php endforeach;?>
        </div>
    </div>
</div>

